package edu.sctu.xiangkun.day201506.day20150617;

import java.io.*;

/**
 * Created by user04 on 2015/6/17.
 */
public class DemoThree {
    public void getFileWriter(){
        int str = 0;
        char[] buffer = new char[1024];
        try{
            File file1 = new File("D://hc.txt");
            File file2 = new File("D://hc2.txt");
            FileReader fileReader = new FileReader(file1);
            FileWriter fileWriter = new FileWriter(file2);
            while((str = fileReader.read(buffer)) != -1){
                fileWriter.write(buffer,0,str);
                System.out.println(str);
            }


            try{
                fileReader.close();
                fileWriter.close();
            }catch(IOException e){
                e.printStackTrace();
            }

        }catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
